#include<stdbool.h>
#include<stdlib.h>
#include<string.h>
bool checkDistances(char *s, int *distance, int distanceSize)
{
    int str = strlen(s);
    int buff[str];
    memset(buff, 0, sizeof(buff));
    int i, j;
    for (; i < str - 1; i++)
    {
        if (buff[i])
            continue;
        for (j = i + 1; j < str; j++)
        {
            if (s[i] == s[j])
            {
                buff[i] = 1;
                buff[j] = 1;
                if (distance[s[i] - 97] != (j - i - 1))
                    return false;
                break;
            }
        }
    }
    return true;
}
